<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <body>

        <ui:composition template="./TemplatePrincipal.xhtml">

            <ui:define name="top">
                top
            </ui:define>

            <ui:define name="left">
                <h:form>
                    <p:commandButton action="CategoryList" value="Regresar"/>
                </h:form>
            </ui:define>

            <ui:define name="content">
                <f:view>
                    <h:form>
                        <center>
                        <p:growl>
                            <h1><h:outputText value="Create/Edit"/></h1>
                            <p:panelGrid columns="2">
                                <p:outputLabel value="Clave:" for="clave" />
                                <p:inputMask mask="9999" id="clave" value="#{categoryBean.category.clave}" title="Clave" required="true" requiredMessage="The Clave field is required." validatorMessage="La clave debe ser mayor a 4 caracteres"/>

                                <p:outputLabel value="Descripcion:" for="descripcion" />
                                <p:inputText id="descripcion" value="#{categoryBean.category.descripcion}" title="Descripcion" required="true" requiredMessage="The Descripcion field is required." validatorMessage="La descripcion debe empezar con mayuscula">
                                    <f:validateRegex pattern="^[A-Za-z\s]+$"/>
                                </p:inputText>
                                <p:outputLabel value="Color:" for="color" />
                                <p:inputText id="color" value="#{categoryBean.category.color}" title="Color" required="true" validatorMessage="El color debe ">
                                    <f:validateLongRange minimum="4" maximum="20"/>
                                </p:inputText>
                            </p:panelGrid>
                            <p:commandButton action="CategoryList" immediate="true" value="Cancelar" ajax="false"/>
                            <p:commandButton action="CategoryConfirm" value="Confirmar" ajax="false"/>
                        </p:growl>
                        </center>
                    </h:form>
                </f:view>

            </ui:define>

        </ui:composition>

    </body>
</html>
